package dcc.service;

import dcc.model.OperationManagementInfo;
import dcc.persistence.OperationManagementMapper;

public class OperationManagementService extends BaseService {

	public OperationManagementService() {
		super(OperationManagementService.class);
	}

	private OperationManagementMapper operationManagementMapper;

	public void setOperationManagementMapper(
			OperationManagementMapper operationManagementMapper) {
		this.operationManagementMapper = operationManagementMapper;
	}

	public void save(OperationManagementInfo operationManagementInfo) {
		if (operationManagementInfo.getId() == 0) {
			insert(operationManagementInfo);
		} else {
			update(operationManagementInfo);
		}
	}

	private void insert(OperationManagementInfo operationManagementInfo) {
		operationManagementMapper.insert(operationManagementInfo);
	}

	private void update(OperationManagementInfo operationManagementInfo) {
		operationManagementMapper.update(operationManagementInfo);
	}

	public OperationManagementInfo getOperationManagementInfoByBaseId(int baseId) {
		return operationManagementMapper
				.getOperationManagementInfoByBaseId(baseId);
	}

}
